package com.xiang.demo;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    public static final String TAG = "MainActivity";


    private Button submit_btn;
    private EditText neme_edt;
    private EditText pwd_edt;
    private Context mContext;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mContext = this;

        neme_edt = findViewById(R.id.neme_edt);
        pwd_edt = findViewById(R.id.pwd_edt);
        submit_btn = findViewById(R.id.submit_btn);

        submit_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                String neme = neme_edt.getText().toString();
                String pwd = pwd_edt.getText().toString();

                String showTxt = "名称：" + neme + "密码：" + pwd;
                Toast.makeText(mContext, showTxt, Toast.LENGTH_LONG).show();


                HelloWorld helloWorld = new HelloWorld();
                String txt = helloWorld.getText();
                Log.d(TAG, "获得c HelloWorld:" + txt);
                Hello hello = new Hello();
                String txt2 = hello.getText();


                Log.d(TAG, "获得c Hello非静态成员变量:" + txt2);
                Log.d(TAG, "获得c Hello 静态成员变量 :" + hello.getNumber());
                Log.d(TAG, "获得c Hello 非静态方法 :" + hello.outPut());
                Log.d(TAG, "获得c Hello 静态方法 :" + hello.outPutStatic());

                Log.d(TAG, "获得c Hello 动态注册方法 add :" + hello.add(5, 2));
                Log.d(TAG, "获得c Hello 动态注册方法 sub :" + hello.sub(5, 2));
                Log.d(TAG, "获得c Hello 动态注册方法  mul:" + hello.mul(5, 2));
               Log.d(TAG, "获得c Hello 动态注册方法  div:" + hello.div(5, 2));


                startActivity(new Intent(MainActivity.this, CalculatorActivity.class));

            }
        });
    }


}
